<%layout("/common/g_layout.html"){%>

<div class="container gr">
    <div class="row gr-title">
        <h2>我的小组话题</h2>
    </div>
    <div class="row">
        <div class="col-md-8 gr-main">
            <!--一页最多20个-->
            <%
            for(topic in topics.list){
            %>
            <div class="gr-topic">
                <span class="gr-title"><a href="/topic/goTopic?id=${topic.id}" onclick="javascript:;">${topic.name}</a></span>
                <span class="gr-respTime">${topic.commentnum}回应&nbsp;&nbsp;${printTime(topic.update_time)}</span>
                <span class="belong"><a href="/group/toGroupindex?id=${topic.group_id}">${topic.group_name}</a></span>
            </div>
            <%}%>
            <div class="page">
                <ul class="pagination">


                    <li>
                        <a href="
                            <%
                            if(topics.pager.pageNumber==1){
                                  %>
                                  #
                                  <%
                            }else{
                            %>
                                ${ctxPath}/topic/toTopicindex?page=${topics.pager.pageNumber-1}
                            <%
                            }
                            %>" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <%
                    if(topics.pager.pageCount<=5){
                    i = 0;
                    while(true){
                    i++;
                    if(i>topics.pager.pageCount){
                    break;
                    }

                    %>
                    <li><a href="${ctxPath}/topic/toTopicindex?page=${i}">${i}</a></li>
                    <%}}%>

                    <%
                    var i;
                    if(topics.pager.pageCount>5){
                    if(topics.pager.pageNumber-3>0){
                    i=topics.pager.pageNumber-3;
                    }else{
                    i = 0;
                    }
                    var j = i;
                    while(true){
                    i++;
                    if(i-j>5||i>topics.pager.pageCount){
                    break;
                    }

                    %>
                    <li><a href="${ctxPath}/topic/toTopicindex?page=${i}">${i}</a></li>
                    <%}}%>

                    <li>
                        <a href="
					      <%
                            if(topics.pager.pageNumber==topics.pager.pageCount){
                                  %>
                                  #
                                  <%
                            }else{
                            %>
                                ${ctxPath}/topic/toTopicindex?page=${topics.pager.pageNumber+1}
                            <%
                            }
					       %> " aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="col-md-4 gr-side">
            <div class="gr-avatar-wrap">
                <img src="../images/avatar.jpg" alt="xxx" class="gr-avatar"/>

                <p><a href="${ctxPath}/group/goGroups">我的小组主页</a></p>

                <p><a href="/group/goGroups" onclick="javascript:;">发起(0)</a>&nbsp;|&nbsp;<a href="/group/goGroups">回应(4)</a>
                </p>
            </div>
            <div class="gr-create">
                <a href="${ctxPath}/group/togroup" class="btn btn-info btn-lg" role="button">创建我的小组</a>
            </div>
            <div class="gr-joinList">
                <div class="side-header clearfix">
                    <p class="pull-left">加入的小组</p>
                    <a href="/group/goGroups" class="pull-right">全部&gt;&gt;</a>
                </div>
                <%
                for(g in groups){
                %>
                <a href="/group/toGroupindex?id=${g.id}"><img src="${g.imageurl}" alt="龙猫"></a>

                <%}%>
            </div>
        </div>
    </div>
</div>

<%include("/common/footer.html"){}%>

<script src="/group/js/scripts/jquery-2.1.1.min.js"></script>
<script src="${ctxPath}/group/js/scripts/nav.js"></script>



<%}%>